<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Convert &quot;kana&quot; one from another (&quot;zen-kaku&quot;, &quot;han-kaku&quot; and more)</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.mb-convert-encoding.html">« mb_convert_encoding</a></li>
      <li style="float: right;"><a href="function.mb-convert-variables.html">mb_convert_variables »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.mbstring.html">多字节字符串 函数</a></li>
    <li>Convert &quot;kana&quot; one from another (&quot;zen-kaku&quot;, &quot;han-kaku&quot; and more)</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.mb-convert-kana" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_convert_kana</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">mb_convert_kana</span> &mdash; <span class="dc-title">Convert &quot;kana&quot; one from another (&quot;zen-kaku&quot;, &quot;han-kaku&quot; and more)</span></p>

 </div>
   
 <div class="refsect1 description" id="refsect1-function.mb-convert-kana-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_convert_kana</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$mode</code><span class="initializer"> = &quot;KV&quot;</span></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$encoding</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type">string</span></div>

  <p class="para rdfs-comment">
   Performs a &quot;han-kaku&quot; - &quot;zen-kaku&quot; conversion for <span class="type">string</span> <code class="parameter">string</code>. 
   This function is only useful for Japanese.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-convert-kana-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">string</code></dt>

     <dd>

      <p class="para">
       The <span class="type">string</span> being converted.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">mode</code></dt>

     <dd>

      <p class="para">
       The conversion option.
      </p>
      <p class="para">
       Specify with a combination of following options.
       <table class="doctable table">
        <caption><strong>Applicable Conversion Options</strong></caption>
        
         <thead>
          <tr>
           <th>Option</th>
           <th>Meaning</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><code class="literal">r</code></td>
           <td>
            Convert &quot;zen-kaku&quot; alphabets to &quot;han-kaku&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">R</code></td>
           <td>
            Convert &quot;han-kaku&quot; alphabets to &quot;zen-kaku&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">n</code></td>
           <td>
            Convert &quot;zen-kaku&quot; numbers to &quot;han-kaku&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">N</code></td>
           <td>
            Convert &quot;han-kaku&quot; numbers to &quot;zen-kaku&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">a</code></td>
           <td>
            Convert &quot;zen-kaku&quot; alphabets and numbers to &quot;han-kaku&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">A</code></td>
           <td>
            Convert &quot;han-kaku&quot; alphabets and numbers to &quot;zen-kaku&quot;
            (Characters included in &quot;a&quot;, &quot;A&quot; options are
            U+0021 - U+007E excluding U+0022, U+0027, U+005C, U+007E)
           </td>
          </tr>

          <tr>
           <td><code class="literal">s</code></td>
           <td>
            Convert &quot;zen-kaku&quot; space to &quot;han-kaku&quot; (U+3000 -&gt; U+0020)
           </td>
          </tr>

          <tr>
           <td><code class="literal">S</code></td>
           <td>
            Convert &quot;han-kaku&quot; space to &quot;zen-kaku&quot; (U+0020 -&gt; U+3000)
           </td>
          </tr>

          <tr>
           <td><code class="literal">k</code></td>
           <td>
            Convert &quot;zen-kaku kata-kana&quot; to &quot;han-kaku kata-kana&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">K</code></td>
           <td>
            Convert &quot;han-kaku kata-kana&quot; to &quot;zen-kaku kata-kana&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">h</code></td>
           <td>
            Convert &quot;zen-kaku hira-gana&quot; to &quot;han-kaku kata-kana&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">H</code></td>
           <td>
            Convert &quot;han-kaku kata-kana&quot; to &quot;zen-kaku hira-gana&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">c</code></td>
           <td>
           Convert &quot;zen-kaku kata-kana&quot; to &quot;zen-kaku hira-gana&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">C</code></td>
           <td>
            Convert &quot;zen-kaku hira-gana&quot; to &quot;zen-kaku kata-kana&quot;
           </td>
          </tr>

          <tr>
           <td><code class="literal">V</code></td>
           <td>
            Collapse voiced sound notation and convert them into a character. Use with &quot;K&quot;,&quot;H&quot;
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>

    
    
     <dt>
<code class="parameter">encoding</code></dt>

     <dd>

      <p class="para"><code class="parameter">encoding</code>
参数为字符编码。如果省略或是 <strong><code>null</code></strong>，则使用内部字符编码。</p>
     </dd>

    
   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.mb-convert-kana-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The converted <span class="type">string</span>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.mb-convert-kana-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
  <td>8.0.0</td>
  <td>
   现在 <code class="parameter">encoding</code> 可以为 null。
  </td>
 </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.mb-convert-kana-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2561">
    <p><strong>示例 #1 <span class="function"><strong>mb_convert_kana()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;Convert&nbsp;all&nbsp;"kana"&nbsp;to&nbsp;"zen-kaku"&nbsp;"kata-kana"&nbsp;*/<br /></span><span style="color: #0000BB">$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mb_convert_kana</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"KVC"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Convert&nbsp;"han-kaku"&nbsp;"kata-kana"&nbsp;to&nbsp;"zen-kaku"&nbsp;"kata-kana"&nbsp;<br />&nbsp;&nbsp;&nbsp;and&nbsp;"zen-kaku"&nbsp;alphanumeric&nbsp;to&nbsp;"han-kaku"&nbsp;*/<br /></span><span style="color: #0000BB">$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mb_convert_kana</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"KVa"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


</div></div></div></body></html>